#include "Geometry.h"

bool CGeometry::bUseIndexDraw() const {
    return !indices.empty();
}

uint32_t CGeometry::getVertexCount() const {
    return vertices.size();
}

uint32_t CGeometry::geIndexCount() const {
    return indices.size();
}

void CGeometry::destroy(VkDevice device) {
    if(vertexBuffer != VK_NULL_HANDLE){
        vkDestroyBuffer(device, vertexBuffer, VK_ALLOC);
    }
    if(vertexMemory != VK_NULL_HANDLE){
        vkFreeMemory(device, vertexMemory, VK_ALLOC);
    }
    if(indexBuffer != VK_NULL_HANDLE){
        vkDestroyBuffer(device, indexBuffer, VK_ALLOC);
    }
    if(indexMemory != VK_NULL_HANDLE){
        vkFreeMemory(device, indexMemory, VK_ALLOC);
    }
    vertices.clear();
    indices.clear();
}
